package com.hmy.finance.api.bo.core.request.enums;

import lombok.Getter;

/**
 * 账单类型
 *
 * @author songkf
 */

@Getter
public enum StatementTypeEnum {
    //账单类型（1-月结，2-期结，3-总账单，4-自由账单）
    MONTHLY("1", "月结"),
    PERIODIC("2", "期结"),
    TOTAL("3", "总账单"),
    FLEXIBLE("5","灵活账单"),
    FREE("4", "自由账单");
    private final String value;
    private final String desc;

    private StatementTypeEnum(String value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    //getDescbyValue
    public static String getDescByValue(String value) {
        for (StatementTypeEnum e : StatementTypeEnum.values()) {
            if (e.getValue().equals(value)) {
                return e.getDesc();
            }
        }
        return null;
    }

    public static StatementTypeEnum getEnumByValue(String value) {
        for (StatementTypeEnum e : StatementTypeEnum.values()) {
            if (e.getValue().equals(value)) {
                return e;
            }
        }
        return null;
    }
}
